473,554 Members | 2,182 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need help converting 'onclick' script to 'href' script...

I've searched the web as well as I can for a solution to this problem
but have found nothing and just don't know enough about JavaScript to
figure out what's going. What I'm trying to do is convert this script:

<a href="#"
onclick="MM_goT oURL('parent.fr ames[\'movieA\']','color2.html' );return
document.MM_ret urnValue">TEST</a>

....to something that I can use within a Flash movie, which as far as I
can tell means that it needs to reside in the 'href' (GetURL) attribute
instead of a separate 'onclick' event. I've tried to do this with this
test version:

<a
href="javascrip t:MM_goToURL('p arent.frames[\'movieA\']','color2.html' );return
document.MM_ret urnValue">TEST2 </a>

....which seems to be working in Firefox/Mac, but nowhere else (IE and
Safari are the only other browsers I really care about). I'm hoping
that you JS pros will know immediately what the problem is here (other
than the author not knowing what he's doing). Thanks in advance to
anyone who can help.

In case anyone is interested, I'm attempting to setup a Flash-based
portfolio site that displays loaded-on-the-fly content in pop-up
iFrames above the movie (*that* much I've figured out). The script
above references this Macromedia script:

<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL .arguments; document.MM_ret urnValue = false;
for (i=0; i<(args.length-1); i+=2)
eval(args[i]+".location='"+ args[i+1]+"'");
}
//-->
</script>

The only technical hitch I have now is getting this script to do the
popping.

Thanks!
- whit

Dec 26 '06 #1
9 8546
I know that in IE you can do this but its very picky and if you do it
the wrong way it either gives you a blank page or an error. I know for
a fact that I have something like the following code working in IE 5
and above:

<a href="javascrip t:parent.doSome thing('5273')"; >

The only real difference between mine and yours is that you have more
than one statement inside the javascript: part. I would recommend
trying to do the same thing except put the return statement inside your
function instead of inline in the javascript: command.

ie try it without the "return
document.MM_ret urnValue" inside your <a tag.
Oh and looking at it again I know that having " " and ' ' begins to
cause problems in this particular href=javascript notation. I have had
many problems with it in the past. If the above doesnt work I would
recommend remove the escape characters \' as these may be confusing
it. If you can , handle the escape character inside the actual
function.

the simpler that href=javascript command is , the easier it will be
for you to debug, of this im sure. Try to do as much as you can inside
the function.
wh********@gmai l.com wrote:
I've searched the web as well as I can for a solution to this problem
but have found nothing and just don't know enough about JavaScript to
figure out what's going. What I'm trying to do is convert this script:

<a href="#"
onclick="MM_goT oURL('parent.fr ames[\'movieA\']','color2.html' );return
document.MM_ret urnValue">TEST</a>

...to something that I can use within a Flash movie, which as far as I
can tell means that it needs to reside in the 'href' (GetURL) attribute
instead of a separate 'onclick' event. I've tried to do this with this
test version:

<a
href="javascrip t:MM_goToURL('p arent.frames[\'movieA\']','color2.html' );return
document.MM_ret urnValue">TEST2 </a>

...which seems to be working in Firefox/Mac, but nowhere else (IE and
Safari are the only other browsers I really care about). I'm hoping
that you JS pros will know immediately what the problem is here (other
than the author not knowing what he's doing). Thanks in advance to
anyone who can help.

In case anyone is interested, I'm attempting to setup a Flash-based
portfolio site that displays loaded-on-the-fly content in pop-up
iFrames above the movie (*that* much I've figured out). The script
above references this Macromedia script:

<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL .arguments; document.MM_ret urnValue = false;
for (i=0; i<(args.length-1); i+=2)
eval(args[i]+".location='"+ args[i+1]+"'");
}
//-->
</script>

The only technical hitch I have now is getting this script to do the
popping.

Thanks!
- whit
Dec 26 '06 #2
Thanks a lot for the reply, dalouis. I've done a little tinkering and
am still not have having any real luck. My revised setup is this:

<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL .arguments; document.MM_ret urnValue = false;
for (i=0; i<(args.length-1); i+=2)
eval(args[i]+".location='"+ args[i+1]+"'");
return true
}
//-->
</script>

<a
href="javascrip t:MM_goToURL('p arent.frames[\'movieA\']','color2.html' )">TEST2</a>

This setup is still working fine in Safari (I had my browser details
wrong in the original message), but in Firefox it's causing the link to
bounce me to a page that just says "false" (you probably could have
told me that by looking at the function). I tried removing the escapes
outright, which broke the setup completely, but I re-read the reply and
realized you meant for me to move them up to the function. Problem is,
I don't have any idea where or how to do that. Any more tips?
dalouis wrote:
I know that in IE you can do this but its very picky and if you do it
the wrong way it either gives you a blank page or an error. I know for
a fact that I have something like the following code working in IE 5
and above:

<a href="javascrip t:parent.doSome thing('5273')"; >

The only real difference between mine and yours is that you have more
than one statement inside the javascript: part. I would recommend
trying to do the same thing except put the return statement inside your
function instead of inline in the javascript: command.

ie try it without the "return
document.MM_ret urnValue" inside your <a tag.

Oh and looking at it again I know that having " " and ' ' begins to
cause problems in this particular href=javascript notation. I have had
many problems with it in the past. If the above doesnt work I would
recommend remove the escape characters \' as these may be confusing
it. If you can , handle the escape character inside the actual
function.

the simpler that href=javascript command is , the easier it will be
for you to debug, of this im sure. Try to do as much as you can inside
the function.
wh********@gmai l.com wrote:
I've searched the web as well as I can for a solution to this problem
but have found nothing and just don't know enough about JavaScript to
figure out what's going. What I'm trying to do is convert this script:

<a href="#"
onclick="MM_goT oURL('parent.fr ames[\'movieA\']','color2.html' );return
document.MM_ret urnValue">TEST</a>

...to something that I can use within a Flash movie, which as far as I
can tell means that it needs to reside in the 'href' (GetURL) attribute
instead of a separate 'onclick' event. I've tried to do this with this
test version:

<a
href="javascrip t:MM_goToURL('p arent.frames[\'movieA\']','color2.html' );return
document.MM_ret urnValue">TEST2 </a>

...which seems to be working in Firefox/Mac, but nowhere else (IE and
Safari are the only other browsers I really care about). I'm hoping
that you JS pros will know immediately what the problem is here (other
than the author not knowing what he's doing). Thanks in advance to
anyone who can help.

In case anyone is interested, I'm attempting to setup a Flash-based
portfolio site that displays loaded-on-the-fly content in pop-up
iFrames above the movie (*that* much I've figured out). The script
above references this Macromedia script:

<script type="text/JavaScript">
<!--
function MM_goToURL() { //v3.0
var i, args=MM_goToURL .arguments; document.MM_ret urnValue = false;
for (i=0; i<(args.length-1); i+=2)
eval(args[i]+".location='"+ args[i+1]+"'");
}
//-->
</script>

The only technical hitch I have now is getting this script to do the
popping.

Thanks!
- whit
Dec 27 '06 #3
Doesn't look like "bumping" works in newsgroups like this, but I'll try
it anyway. Anybody out there who can shed some light on this issue?

Dec 30 '06 #4
VK
wh********@gmai l.com wrote:
Doesn't look like "bumping" works in newsgroups like this, but I'll try
it anyway. Anybody out there who can shed some light on this issue?
You cannot do it on modern browsers with the default Flash player
installation.
javascript:void (codeToExecute) pseudo-protocol trick was good for a
long time but now it's blocked as well.

On IE 6,7 it's simply ignored, on Firefox you'll see a security warning
dialog. It is because the modern Flash player is a sophisticated
programming environment by its own with security policies differing
sometimes from the policies of the browser it is run on (XMLHttpRequest
cross-domain communication is the first comming into my mind).
Respectively it may have his very own security exploits which browser
producers do not want to be held responsible for.

This way either abandon Flash whatsoever or make the entire interface
as one big Flash movie.

Dec 30 '06 #5
Crap. That screws up my plan. I really don't want to enclose the entire
thing in a Flash movie. No wonder the existing setup wasn't working in
any browser that I was testing it in. Still, how is that different from
issuing JS pop-up window commands? The pop-up contact form at this site
still works:
http://www.morris-day.com/home.html (click "Contact Us" then the
"Contact Form" link)

I can make my plan work with actual pop-up windows, I'd just prefer to
use DIVs. At any rate, thanks for the reply, VK.
VK wrote:
You cannot do it on modern browsers with the default Flash player
installation.
javascript:void (codeToExecute) pseudo-protocol trick was good for a
long time but now it's blocked as well.

On IE 6,7 it's simply ignored, on Firefox you'll see a security warning
dialog. It is because the modern Flash player is a sophisticated
programming environment by its own with security policies differing
sometimes from the policies of the browser it is run on (XMLHttpRequest
cross-domain communication is the first comming into my mind).
Respectively it may have his very own security exploits which browser
producers do not want to be held responsible for.

This way either abandon Flash whatsoever or make the entire interface
as one big Flash movie.
Dec 30 '06 #6
VK

wh********@gmai l.com wrote:
>. Still, how is that different from
issuing JS pop-up window commands? The pop-up contact form at this site
still works:
http://www.morris-day.com/home.html (click "Contact Us" then the
"Contact Form" link)
Difficult to say - as I said Flash ActionScript may have its own
vulnerabilities and respectively its own bug exploits. From the other
side I see address bar flashing for a sec in the new window but
disappearing after. So maybe they simply do getURL(formPage ) with
_target blank - so no javascript usage from movie, pure HTML mechanics,
and the script on formPage does the rest.

I don't want to decompile someone's movie without permission, so I
cannot tell for sure.

See also
<http://www.macromedia. com/support/documentation/en/flashplayer/help/settings_manage r.html#117164>

Dec 30 '06 #7
I should have specified that I created it - years ago, so I didn't
remember what the setup was - and also didn't realize I had the source
file handy. It looks like you're half right:
on (release) {
getURL("javascr ipt:openNewWind ow('contact.htm l','contact','h eight=700,width =800,toolbar,sc rollbars,resiza ble,left=20,top =20')");
}

All the parameters seem to be contained in the one "URL," so I guess
this is allowed because it's not calling a function elsewhere on the
page?
VK wrote:
Difficult to say - as I said Flash ActionScript may have its own
vulnerabilities and respectively its own bug exploits. From the other
side I see address bar flashing for a sec in the new window but
disappearing after. So maybe they simply do getURL(formPage ) with
_target blank - so no javascript usage from movie, pure HTML mechanics,
and the script on formPage does the rest.

I don't want to decompile someone's movie without permission, so I
cannot tell for sure.

See also
<http://www.macromedia. com/support/documentation/en/flashplayer/help/settings_manage r.html#117164>
Dec 30 '06 #8
VK
wh********@gmai l.com wrote:
I should have specified that I created it - years ago, so I didn't
remember what the setup was - and also didn't realize I had the source
file handy. It looks like you're half right:
on (release) {
getURL("javascr ipt:openNewWind ow('contact.htm l','contact','h eight=700,width =800,toolbar,sc rollbars,resiza ble,left=20,top =20')");
}

All the parameters seem to be contained in the one "URL," so I guess
this is allowed because it's not calling a function elsewhere on the
page?
That is a fancy matter. On my Firefox 1.5 / Flash 9.0 plugin for your
side I'm indeed getting popup window. At the same time even for a
_local_ page having openNewWindow function called from flash by
getURL("javascr ipt:openNewWind ow()") I'm getting security alert.

I'm admittedly not a profound specialist of Flash <JavaScript
bridging, maybe it's time for a more specific group like
<macromedia.fla sh.actionscript >. Some answer can be also hidden at
<http://www.macromedia. com/support/documentation/en/flashplayer/help/settings_manage r04a.html#11906 5>

If you come up with an explanation, it would be hice to have it posted
here.

Dec 30 '06 #9
I'll open up a conversation on that group and let you know if the
question gets answered. Thanks for your feedback, VK.
VK wrote:
wh********@gmai l.com wrote:
I should have specified that I created it - years ago, so I didn't
remember what the setup was - and also didn't realize I had the source
file handy. It looks like you're half right:
on (release) {
getURL("javascr ipt:openNewWind ow('contact.htm l','contact','h eight=700,width =800,toolbar,sc rollbars,resiza ble,left=20,top =20')");
}

All the parameters seem to be contained in the one "URL," so I guess
this is allowed because it's not calling a function elsewhere on the
page?
Dec 30 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5167
by: Steve | last post by:
Hi, I have a nice little script that works well displaying images on my website. It's a script where if you clik a thumbnail image a pop up window opens that contains a larger version of the same image. What I would like to create is a link that can be clicked on to close the window that contains the larger image. This would make it easier...
5
10866
by: Mike | last post by:
In my previous post, I wrote: > ... > GOAL: (very simple) Provide a hyperlink which, when clicked, > calls a javascript function which opens a new URL. > ... > PROBLEM: The following code works fine if I click to open in > the same window, but if I click the browser option to open in a > new window, the new window tries to open the...
2
3866
by: Jackson Yap | last post by:
can someone kind enough to help me look at the attached html and js file? Why is it that the javascript menu could not work at www.apchosting.net but could work at http://home.pacific.net.sg/~jacksony ? (the drop down bar could not work at www.apchosting.net but can drop at home.pacific.net.sg. I suspect it is a server problem but was told it...
28
2572
by: Randy Starkey | last post by:
Hi, Does anyone know where I can get a script that show a little plus sign after a line of text, that when you click the plus sign, more text is revealed on that same page, like a continuing paragraph. This will be on a web page. Thanks! --Randy Starkey
7
2522
by: fox | last post by:
Hi, Lacking javascript knowledge, I just realized why my project has a bug. I am using ASP to loop through a set of records while it creates URLs with a querystring that has a single value pair. This URL needs to open in a floating window if clicked. (this is for an administrator and so opening a small floater gives them more efficient...
11
2989
by: GaryB | last post by:
Hi Guys, I've been battling with this one for hours - I hope that you can help me! My code modifies the <aon a page, from a standard document link into a link with a tailored onclick event. It works perfectly (assigning the correct images and the correct onclick events to the correct <atags):
1
3037
by: bhosalevivek | last post by:
I did this code from Dynamic Drive DHTML. it's working properly, but now I need submenu for "Submenu 1.2", means when I take mouse on "Submenu 1.2" I need to display "Submenu 1.2.1". I try to do this but it could't work. hope you understand my Language and My problem. please help me. Code is below. <html> <head>
2
1613
by: registry | last post by:
<%@Language="VBSCRIPT" CODEPAGE="1252"%> <html> <head> <title>Registry Network Hospital Detail</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="JavaScript" type="text/JavaScript"> <!-- function MM_reloadPage(init) { //reloads the window if Nav4 resized
5
8668
by: dangt85 | last post by:
Hello, I have the following page: ... <style type="text/css"> body { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 12px; }
0
7611
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7812
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8051
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7574
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7894
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6161
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5442
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5162
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
2026
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.